package org.bot.server.utils;

import com.alibaba.fastjson.JSONObject;

/**
 * @author 沧月
 * @create 0020 2023/9/20 09:59
 * @description <description class purpose>
 */
public class BaseController {

    public JSONObject sendOK() {
        return this._send("ok", "", 0);
    }

    private JSONObject _send(String msg, Object data, int code) {
        return new JSONObject().fluentPut("msg", msg).fluentPut("code", code).fluentPut("data", data);
    }

    public JSONObject sendData(Object data) {
        return this._send("ok", data, 0);
    }

    public JSONObject sendError(String msg) {
        return this._send(msg, "", -1);
    }
}
